package com.zbhk.qc.controller;

import com.zbhk.qc.dto.BaseResponseEntity;
import com.zbhk.qc.dto.BgLoginOutput;
import com.zbhk.qc.dto.LoginInput;
import com.zbhk.qc.service.BgUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

@Slf4j
@RestController("BgUserController")
@RequestMapping(value = "/bgUser")
@RequiredArgsConstructor
@Api(tags = "后台管理用户相关接口")
public class BgUserController {

    @Autowired
    private BgUserService bgUserService;

    @ApiOperation(value = "登录", notes = "", produces = "application/json")
    @PostMapping("/login")
    public BaseResponseEntity<BgLoginOutput> register(
            @Valid @ModelAttribute LoginInput loginInput, HttpServletRequest request) {
        return bgUserService.start(loginInput,request);
    }


}
